import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;


// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main {
    static Map<Integer,Integer> hash = new HashMap<>();
    static int n,m;
    public static boolean check(int x){
        int g = 0;
        for (int a : hash.values()){
            g += a / x + (a % x == 0 ? 0 : 1);
        }
        return g <= m;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        // 注意 hasNext 和 hasNextLine 的区别
        n = in.nextInt();
        m = in.nextInt();
        int hashMax = 0;
        for (int i = 0; i < n; i++) {
            int x = in.nextInt();
            hash.put(x,hash.getOrDefault(x,0)+1);
            hashMax = Math.max(hashMax,hash.get(x));
        }
        if(hash.size() > m){
            System.out.println(-1);
        }else {
            int left = 1;
            int right = hashMax;
            while (left < right){
                int mid = (left + right) / 2;
                if(check(mid)){
                    right = mid;
                }else {
                    left = mid + 1;
                }
            }
            System.out.println(left);
        }
    }

}